// config/env.js
// 环境配置管理

const ENV_CONFIG = {
  // 开发环境
  development: {
    API_BASE_URL: 'http://localhost:8080',
    MOCK_MODE: false,
    DEBUG: true,
    LOG_LEVEL: 'debug'
  },

  // 测试环境
  testing: {
    API_BASE_URL: 'https://test-api.your-domain.com/api',
    MOCK_MODE: false,
    DEBUG: true,
    LOG_LEVEL: 'info'
  },

  // 生产环境
  production: {
    API_BASE_URL: 'https://api.your-domain.com/api',
    MOCK_MODE: false,
    DEBUG: false,
    LOG_LEVEL: 'error'
  }
};

// 当前环境（可以通过编译时设置）
const CURRENT_ENV = 'development'; // development | testing | production

// 获取当前环境配置
const getCurrentConfig = () => {
  return ENV_CONFIG[CURRENT_ENV] || ENV_CONFIG.development;
};

// 环境判断工具
const isDev = () => CURRENT_ENV === 'development';
const isTest = () => CURRENT_ENV === 'testing';
const isProd = () => CURRENT_ENV === 'production';

module.exports = {
  ENV_CONFIG,
  CURRENT_ENV,
  getCurrentConfig,
  isDev,
  isTest,
  isProd
};
